package cn.icanci.ladybird.service.impl;

import cn.icanci.ladybird.pojo.entity.TicketDetailsTicketAddressMiddle;
import cn.icanci.ladybird.dao.TicketDetailsTicketAddressMiddleDao;
import cn.icanci.ladybird.service.TicketDetailsTicketAddressMiddleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (TicketDetailsTicketAddressMiddle)表服务实现类
 *
 * @author makejava
 * @since 2020-09-29 20:43:51
 */
@Service("ticketDetailsTicketAddressMiddleService")
public class TicketDetailsTicketAddressMiddleServiceImpl implements TicketDetailsTicketAddressMiddleService {
    @Resource
    private TicketDetailsTicketAddressMiddleDao ticketDetailsTicketAddressMiddleDao;

    /**
     * 通过ID查询单条数据
     *
     * @param ticketDetailsTicketAddressMiddleId 主键
     * @return 实例对象
     */
    @Override
    public TicketDetailsTicketAddressMiddle queryById(Long ticketDetailsTicketAddressMiddleId) {
        return this.ticketDetailsTicketAddressMiddleDao.queryById(ticketDetailsTicketAddressMiddleId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<TicketDetailsTicketAddressMiddle> queryAllByLimit(int offset, int limit) {
        return this.ticketDetailsTicketAddressMiddleDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param ticketDetailsTicketAddressMiddle 实例对象
     * @return 实例对象
     */
    @Override
    public TicketDetailsTicketAddressMiddle insert(TicketDetailsTicketAddressMiddle ticketDetailsTicketAddressMiddle) {
        this.ticketDetailsTicketAddressMiddleDao.insert(ticketDetailsTicketAddressMiddle);
        return ticketDetailsTicketAddressMiddle;
    }

    /**
     * 修改数据
     *
     * @param ticketDetailsTicketAddressMiddle 实例对象
     * @return 实例对象
     */
    @Override
    public TicketDetailsTicketAddressMiddle update(TicketDetailsTicketAddressMiddle ticketDetailsTicketAddressMiddle) {
        this.ticketDetailsTicketAddressMiddleDao.update(ticketDetailsTicketAddressMiddle);
        return this.queryById(ticketDetailsTicketAddressMiddle.getTicketDetailsTicketAddressMiddleId());
    }

    /**
     * 通过主键删除数据
     *
     * @param ticketDetailsTicketAddressMiddleId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long ticketDetailsTicketAddressMiddleId) {
        return this.ticketDetailsTicketAddressMiddleDao.deleteById(ticketDetailsTicketAddressMiddleId) > 0;
    }

    @Override
    public List<TicketDetailsTicketAddressMiddle> queryByTicketDetailsId(Long ticketDetailsId) {
        return this.ticketDetailsTicketAddressMiddleDao.queryByTicketDetailsId(ticketDetailsId);
    }
}